package com.sinbader.xiaole.common.mapper;

import com.sinbader.xiaole.common.model.result.StockResult;
import com.sinbader.xiaole.common.model.xiaolevo.WarehouseMoveDetailVo;
import com.sinbader.xiaole.common.entity.WarehouseMove;
import com.sinbader.xiaole.common.model.params.WarehouseMoveParam;
import com.sinbader.xiaole.common.model.result.WarehouseMoveResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 仓库移货管理 Mapper 接口
 */
public interface WarehouseMoveMapper extends BaseMapper<WarehouseMove> {

    /**
     * 获取列表
     */
    List<WarehouseMoveResult> customList(@Param("paramCondition") WarehouseMoveParam paramCondition);

    /**
     * 获取map列表
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") WarehouseMoveParam paramCondition);

    /**
     * 获取分页实体列表
     */
    Page<WarehouseMoveResult> customPageList(@Param("page") Page page, @Param("paramCondition") WarehouseMoveParam paramCondition);

    /**
     * 获取分页map列表
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") WarehouseMoveParam paramCondition);

    /**
     * 获取当前交易是否已经存在于交易表中
     * @param paramMap
     * @return
     */
    WarehouseMove selectWarehouMoveByMoveNum(Map<String, Object> paramMap);

    /**
     * 查询当前用户移出仓库下的 商品库存数据
     * @param page 分页数据
     * @param paramCondition 查询参数
     * @return
     */
    Page<StockResult> selectProductStockInfos(@Param("page") Page page, @Param("paramCondition") WarehouseMoveParam paramCondition);

    /**
     * 设置移入货架后，根据所选的库存信息 的id ，查询库存信息以及相关产品信息
     * @param paramMap 参数
     * @return
     */
    WarehouseMoveDetailVo getStockInfoById(Map<String, Object> paramMap);

    /**
     * 更新库存信息中的该商品的仓库id 以及 货架id
     * @param paramMap 参数
     * @return
     */
    int updateStockInfoByStockId(Map<String, Object> paramMap);
}
